package com.tc.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tk.mybatis.spring.mapper.MapperScannerConfigurer;

import java.util.Properties;

/**
 * @Auther: tianchao
 * @Date: 2020/4/25 11:41
 * @Description:
 */
//@Configuration
public class MapperConfig {
    /**
     * Mybatis通用Mapper配置
     *
     * @return
     */
    //@Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        //mapperScannerConfigurer.setBasePackage("cn.XXX.dao.mapper");
        mapperScannerConfigurer.setBasePackage("com.tc.mapper");
        Properties propertiesMapper = new Properties();
        propertiesMapper.setProperty("mappers", "tk.mybatis.mapper.common.Mapper");
        propertiesMapper.setProperty("IDENTITY", "SELECT REPLACE(UUID(),'-','')");
        propertiesMapper.setProperty("ORDER", "BEFORE");
        mapperScannerConfigurer.setProperties(propertiesMapper);
        return mapperScannerConfigurer;

    }
}
